package com.qianxunclub.util;

import java.io.Serializable;

/**
 * Created by zhangbin on 2017/2/21.
 */
public class BaseResponse<T> implements Serializable {
    protected Integer returnCode = Integer.valueOf(1000);
    protected String message;
    protected T dataInfo;
    protected boolean success;

    public BaseResponse() {
        this.setReturn(ReturnCode.CODE_1000);
    }

    public void setReturn(ReturnCode returnCode){
        this.returnCode = returnCode.code();
        this.message = returnCode.message();
    }

    public Integer getReturnCode() {
        return this.returnCode;
    }

    public void setReturnCode(Integer returnCode) {
        this.returnCode = returnCode;
    }

    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getDataInfo() {
        return this.dataInfo;
    }

    public void setDataInfo(T dataInfo) {
        this.dataInfo = dataInfo;
    }

    public boolean isSuccess(){
        if(returnCode.equals(Integer.valueOf(1000))){
            this.success = true;
            return this.success;
        }
        this.success = false;
        return this.success;
    }
}
